/*
 * \brief  Client-side nitpicker view interface
 * \author Norman Feske
 * \date   2006-08-23
 */

/*
 * Copyright (C) 2006-2009 Norman Feske
 * Genode Labs, Feske & Helmuth Systementwicklung GbR
 *
 * This file is part of the Genode OS framework, which is distributed
 * under the terms of the GNU General Public License version 2.
 */

#ifndef _INCLUDE__NITPICKER_VIEW__CLIENT_H_
#define _INCLUDE__NITPICKER_VIEW__CLIENT_H_

#include <nitpicker_view/nitpicker_view.h>
#include <base/ipc.h>

namespace Nitpicker {

	class View_client : public View
	{
		private:

			Genode::Msgbuf<64> _snd_msg, _rcv_msg;
			Genode::Ipc_client _ipc_client;

		public:

			/**
			 * Constructor
			 */
			explicit View_client(View_capability view)
			: _ipc_client(view, &_snd_msg, &_rcv_msg) { }


			/******************************
			 ** Nitpicker view interface **
			 ******************************/

			int viewport(int x, int y, int w, int h,
			             int buf_x, int buf_y, bool redraw)
			{
				return (_ipc_client << VIEWPORT << x << y << w << h
				                                << buf_x << buf_y << redraw
				                                << Genode::IPC_CALL);
			}

			int stack(View_capability neighbor, bool behind, bool redraw)
			{
				return (_ipc_client << STACK << neighbor << behind << redraw
				                             << Genode::IPC_CALL);
			}

			int title(const char *title)
			{
				return (_ipc_client << TITLE << Genode::Buffer(title)
				                             << Genode::IPC_CALL);
			}
	};
}

#endif /* _INCLUDE__NITPICKER_VIEW__CLIENT_H_ */
